package ch04;

public class Pear extends Crop {
    private String brand;                        // 品种

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public Pear() {
        this("皇冠梨");
    }

    public Pear(String brand) {
        super("梨树", 12, 4, 120);
        this.brand = brand;
    }

    @Override
    public void print(){
        super.print();
        System.out.println(this.getName() +"属于水果作物，品种："+this.brand+"。");
    }
    @Override
    public void printGrowReport(int day) {
        System.out.println("您种植了"+super.getName()+"，品种："+this.getBrand());
        super.printGrowReport(day);
    }
    @Override
    public void harvest(){
        super.harvest();
    }

    @Override
    public void disinifestation() {
        System.out.println("梨树梨树!");
    }

    public void grafting(String newBrand){
        if (this.brand == newBrand){
            System.out.println("同一品种果树无需嫁接。");
        }else{
            this.brand = newBrand;
            System.out.println("经过嫁接，"+super.getName()+"的品种变为"+this.getBrand()+"。");
        }
    }
}
